// import 'package:domeone/containercomp.dart';
import 'package:flutter/material.dart';

class Shopitem extends StatelessWidget {
  const Shopitem({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
        width: double.infinity,
        height: 300,
        padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 10),
        color: Colors.grey,
        child: Column(
          children: [
            //头部
            _buildHeader(),
            //内容
            _buildContent(),
            //底部
            _buildFooter(),
          ],
        ));
  }

  Widget _buildHeader() {
    return const Row(
      mainAxisAlignment: MainAxisAlignment.spaceBetween,
      children: [Text('2025-10-26 16:67:09'), Text('待发货')],
    );
  }

  Widget _buildContent() {
    return Container(
      padding: const EdgeInsets.symmetric(vertical: 10),
      child: Row(
        //侧轴顶部对齐
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          //左侧
          Image.network(
            'https://yanxuan-item.nosdn.127.net/a09de222ed32efa8ffe359b1d5780574.jpg',
            width: 100,
            height: 100,
          ),
          const SizedBox(width: 10),
          //右侧
          Expanded(
              flex: 1,
              child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    //上边部分
                    const Row(
                      children: [
                        Expanded(
                          child: Text(
                            '茶水分离杯耐热隔热玻璃杯 茶水分离杯耐热隔热玻璃杯茶水分离杯耐热隔热玻璃杯茶水分离杯耐热隔热玻璃杯',
                            maxLines: 2,
                            overflow: TextOverflow.ellipsis,
                          ),
                        ),
                        SizedBox(width: 10),
                        Text('X2')
                      ],
                    ),
                    //中间部分

                    Container(
                        margin: const EdgeInsets.symmetric(vertical: 10),
                        padding: const EdgeInsets.symmetric(
                            vertical: 2, horizontal: 5),
                        decoration: BoxDecoration(
                            color: Colors.black26,
                            borderRadius: BorderRadius.circular(5)),
                        child: const Text(
                          '规格: 白色240ML',
                          style: TextStyle(fontSize: 12, color: Colors.white),
                        )),
                    //价格
                    const Text(
                      '￥100.00',
                      style: TextStyle(fontSize: 16, color: Colors.red),
                    )
                  ]))
        ],
      ),
    );
  }

  Widget _buildFooter() {
    return SizedBox(
      width: double.infinity,
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.end,
        children: [
          const Text('合计: ￥20.00'),
          const SizedBox(height: 6),
          Container(
            width: 80,
            height: 30,
            decoration: BoxDecoration(
              color: Colors.red,
              borderRadius: BorderRadius.circular(5),
              // 渐变
              gradient: const LinearGradient(
                colors: [Colors.red, Colors.orange],
                begin: Alignment.topLeft,
                end: Alignment.bottomRight,
              ),
            ),
            child: const Center(
              child: Text(
                '去支付',
                style: TextStyle(fontSize: 16, color: Colors.white),
              ),
            ),
          )
        ],
      ),
    );
  }
}
